package com.yanfan.energy.mapper;

import com.yanfan.energy.domain.BaseDictEntity;
import com.yanfan.energy.domain.SaveMoneyQueryByArea;
import com.yanfan.energy.domain.SaveMoneyStandard;
import com.yanfan.energy.domain.SaveMoneyStandardInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (SaveMoneyStandard)表数据库访问层
 *
 * @author makejava
 * @since 2023-05-08 16:48:44
 */
@Repository
public interface SaveMoneyStandardDao {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    SaveMoneyStandard queryById(Long id);

    /**
     * 查询指定行数据
     *
     * @param saveMoneyStandard 查询条件
     * @return 对象列表
     */
    List<SaveMoneyStandard> queryAll(SaveMoneyStandard saveMoneyStandard);

    /**
     * 统计总行数
     *
     * @param saveMoneyStandard 查询条件
     * @return 总行数
     */
    long count(SaveMoneyStandard saveMoneyStandard);

    /**
     * 新增数据
     *
     * @param saveMoneyStandard 实例对象
     * @return 影响行数
     */
    int insert(SaveMoneyStandard saveMoneyStandard);

    /**
     * 批量新增数据（MyBatis原生foreach方法）
     *
     * @param entities List<SaveMoneyStandard> 实例对象列表
     * @return 影响行数
     */
    int insertBatch(@Param("entities") List<SaveMoneyStandard> entities);


    /**
     * 修改数据
     *
     * @param saveMoneyStandard 实例对象
     * @return 影响行数
     */
    int update(SaveMoneyStandard saveMoneyStandard);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 影响行数
     */
    int deleteById(Long id);

    /**
     * 采购标准日志查询
     *
     * @param purchaseSign
     * @param groupByStr
     * @return
     */
    List<SaveMoneyStandard> querySaveMoneyLog(@Param("purchaseSign") int purchaseSign, @Param("groupByStr") String groupByStr);

    /**
     * 查询设备标准
     *
     * @param saveMoneyStandard
     * @return
     */
    List<SaveMoneyStandard> saveMoneyStandardDeviceList(SaveMoneyStandard saveMoneyStandard);

    /**
     * 查询采购标准
     *
     * @param saveMoneyStandard
     * @return
     */
    List<SaveMoneyStandard> saveMoneyStandardPurchaseList(SaveMoneyStandard saveMoneyStandard);

    /**
     * 记录日志
     *
     * @param costList
     * @return
     */
    int recordLog(@Param("entities") List<SaveMoneyStandard> costList);

    void clearSaveMoneyDirtyData(@Param("entities") List<SaveMoneyStandard> costList, @Param("purchaseSign") Integer purchaseSign, @Param("deviceOrWorkshop") String deviceOrWorkshop, @Param("deviceOrWorkshopValue") Integer deviceOrWorkshopValue);

    SaveMoneyStandardInfo saveMoneyStandardDeviceDetail(SaveMoneyStandardInfo saveMoneyStandardInfo);

    List<SaveMoneyStandard> querySaveMoneyByArea(SaveMoneyQueryByArea saveMoneyQueryByArea);

    List<BaseDictEntity> areaList(SaveMoneyQueryByArea saveMoneyQueryByArea);
}

